<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Wry extends MY_Controller {

	public function __construct(){
		parent::__construct();
		session_start();
	}

	public function index()
	{
		$datas = array();
		$this->myweerayaview('welcome', $datas);
	}

	function photo()
	{
		if(isset($_SESSION["userLogin"])){
			$datas = array();
			$this->myweerayaview('photo', $datas, array("weeraya/supersized.css", "weeraya/analog.css"), array("weeraya/supersized.3.1.3.min.js", "weeraya/jquery.clock.js"));
		}else{
			redirect("/");
		}
	}

	function login()
	{
		if($this->input->post("name")=="weeraya" && $this->input->post("keys")=="lovesaom"){
			$_SESSION["userLogin"] = $this->input->post("name");
			redirect("/wry/photo");	
		}else{
			redirect("/");
		}
	}

	function logout()
	{
		session_destroy();
		redirect("/");
	}

}
